package com.cy.pj.sys.dao;

import com.cy.pj.sys.pojo.Node;
import com.cy.pj.sys.pojo.SysMenu;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface SysMenuDao {
    //查询所有的菜单信息
    List<Map<String, Object>> findObjects() ;

    //查询子菜单
    @Select("select count(*) from sys_menus where parentId=#{id}")
    int getChild(Integer id);
    @Delete("delete from sys_menus where id=#{id}")
    int deleteObjects(Integer id);
    @Select("select id,name,parentId from sys_menus")
    List<Node> findZtreeMenuNodes();
    //添加菜单
    int insertObject(SysMenu sysMenu);
    //更新
    int updateObject(SysMenu entity);

    List<String> findPermissions(@Param("menuIds") List<Integer> menuIds);
}
